package com.woniuxy.oldmanapi.mapper;

import com.woniuxy.oldmanapi.entity.Medicine;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
@Repository
public interface MedicineMapper extends Mapper<Medicine> {
    List<Medicine> selectDrugsByCons(String drugname);

    @Update("update medicine set storeCount=#{count}+storeCount where id=#{mid}")
    int backaddScoreCount(@Param("mid") Integer id1, @Param("count") Integer count);

    @Update("update medicine set storeCount=storeCount-#{count} where id=#{mid} and storeCount>=#{count}")
    int loseScoreCount(@Param("mid") Integer id1, @Param("count") Integer count);
}
